namespace ContosoUniversity.Tests
{
    using NUnit.Framework;

    [TestFixture]
    public class CourseControllerQueryServiceTests
    {
    //    [Test]
    //    public void GetAllCoursesAsyncTests()
    //    {
    //        var queryRepository = new InMemoryRecordedQueryRepository(
    //            new Department { DepartmentID = 1 },
    //            new Course { Title = "title2" });

    //        var queryService = new CourseControllerQueryService(queryRepository);
    //        var result = (ExpandoObject)queryService.GetAllCoursesAsync(1).Result;

    //        var departments = result.Single(p => p.Key == "Departments").Value as IEnumerable<Department>;
    //        departments.Count().ShouldEqual(1);

    //        var courses = result.Single(p => p.Key == "Courses").Value as IEnumerable<CourseQueryModel>;
    //        courses.Count().ShouldEqual(0);

    //        // Assert
    //        queryRepository.QueryEvents.Count().ShouldEqual(2);

    //        var departmentQueryEvent = (GetEntitiesRepositoryQueryEvent)queryRepository.QueryEvents.First();
    //        departmentQueryEvent.SpecificationStrategy.GetType().ShouldEqual(typeof(DefaultSpecificationQueryStrategy<Department>));
    //        departmentQueryEvent.ExpectedStrategies(
    //            new DefaultSpecificationQueryStrategy<Department>(),
    //            new OrderByQueryStrategy<Department>(p => p.Name),
    //            new AsNoTrackingQueryStrategy());

    //        // Check second query
    //        var courseQueryEvent = (GetEntitiesRepositoryQueryEvent)queryRepository.QueryEvents.Last();
    //        courseQueryEvent.SpecificationStrategy.GetType().ShouldEqual(typeof(ExpressionSpecificationQueryStrategy<Course>));
    //        courseQueryEvent.ExpectedStrategies(
    //            new ExpressionSpecificationQueryStrategy<Course>(c => c.DepartmentID == 1),
    //            new OrderByQueryStrategy<Course>(p => p.CourseID),
    //            new EagerLoadingQueryStrategy<Course>(p => p.Department),
    //            new AsNoTrackingQueryStrategy());
    //    }
    }
}
